home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1697 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  985 b 

  1. Path: news.tte.vtt.fi!newsmaster
  2. From: Ali Lattunen <Ali.Lattunen@vtt.fi>
  3. Newsgroups: comp.lang.c++
  4. Subject: Template function declaration?
  5. Date: 12 Jan 1996 10:22:18 GMT
  6. Organization: VTT Information Technology
  7. Message-ID: <4d5coq$em1@hemuli.tte.vtt.fi>
  8. NNTP-Posting-Host: tte2053.tte.vtt.fi
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
  13.  
  14.  
  15.   Hi there!
  16.  
  17.   I have a simple question for you experts:
  18.   How to declare a template function in another module?
  19.   Let's say we have a template function max in file foo.cpp
  20.  
  21.   template<class T> T max( T a, T b ) {
  22.      return (a>b) ? a : b;
  23.   }
  24.  
  25.   Then we want to use this function in file bar.cpp. What syntax
  26.   does the declaration have?
  27.  
  28.   I'm pretty new with templates. Can you recommend any book
  29.   concerning programming c++ templates?  
  30.  
  31.   Ali Lattunen
  32.   VTT Information Technology
  33.   Telecommunications
  34.   P.O. Box 1202
  35.   FIN-02044 ESPOO
  36.   Finland
  37.  
  38.